<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>AWS SDK for OpenResty</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>lua-resty-aws</h1>


<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Methods">Methods</a></li>
</ul>


<h2>Classes</h2>
<ul class="nowrap">
  <li><a href="../classes/AWS.html">AWS</a></li>
  <li><a href="../classes/ChainableTemporaryCredentials.html">ChainableTemporaryCredentials</a></li>
  <li><a href="../classes/CredentialProviderChain.html">CredentialProviderChain</a></li>
  <li><strong>Credentials</strong></li>
  <li><a href="../classes/EC2MetadataCredentials.html">EC2MetadataCredentials</a></li>
  <li><a href="../classes/EnvironmentCredentials.html">EnvironmentCredentials</a></li>
  <li><a href="../classes/RemoteCredentials.html">RemoteCredentials</a></li>
  <li><a href="../classes/SharedFileCredentials.html">SharedFileCredentials</a></li>
  <li><a href="../classes/TokenFileWebIdentityCredentials.html">TokenFileWebIdentityCredentials</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
  <li><a href="../modules/resty.aws.config.html">resty.aws.config</a></li>
  <li><a href="../modules/resty.aws.service.rds.signer.html">resty.aws.service.rds.signer</a></li>
  <li><a href="../modules/resty.aws.utils.html">resty.aws.utils</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
  <li><a href="../topics/README.md.html">README</a></li>
</ul>

</div>

<div id="content">

<h1>Class <code>Credentials</code></h1>
<p>Credentials class.</p>
<p> Manually sets credentials.
 Also the base class for all credential classes.</p>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#aws:Credentials">aws:Credentials (opt)</a></td>
	<td class="summary">Constructor.</td>
	</tr>
</table>
<h2><a href="#Methods">Methods</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#credentials:get">credentials:get ()</a></td>
	<td class="summary">Gets credentials, refreshes if required.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#credentials:needsRefresh">credentials:needsRefresh ()</a></td>
	<td class="summary">checks whether credentials have expired.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#credentials:refresh">credentials:refresh ()</a></td>
	<td class="summary">updates credentials.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#credentials:set">credentials:set (accessKeyId, secretAccessKey, sessionToken, expireTime)</a></td>
	<td class="summary">Sets credentials.</td>
	</tr>
</table>

<br/>
<br/>


    <h2 class="section-header "><a name="Functions"></a>Functions</h2>

    <dl class="function">
    <dt>
    <a name = "aws:Credentials"></a>
    <strong>aws:Credentials (opt)</strong>
    </dt>
    <dd>
    Constructor.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">opt</span> options table
        <ul>
        <li><span class="parameter">expiryWindow</span>
         number (default 15) of seconds before expiry to start refreshing
        </li>
        <li><span class="parameter">accessKeyId</span>
         (optional) only specify if you manually specify credentials
        </li>
        <li><span class="parameter">secretAccessKey</span>
         (optional) only specify if you manually specify credentials
        </li>
        <li><span class="parameter">sessionToken</span>
         (optional) only specify if you manually specify credentials
        </li>
        <li><span class="parameter">expireTime</span>
         (optional, number (epoch) or string (rfc3339)). This should
 not be specified. Default: If any of the 3 secrets are given; 10yrs, otherwise 0
 (forcing a refresh on the first call to <a href="../classes/Credentials.html#credentials:get">get</a>).
        </li>
        </li></ul>
    </ul>




    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="keyword">local</span> my_creds = aws:<span class="function-name">Credentials</span> {
  accessKeyId = <span class="string">"access"</span>,
  secretAccessKey = <span class="string">"secret"</span>,
  sessionToken = <span class="string">"token"</span>,
}

<span class="keyword">local</span> success, id, secret, token = my_creds:<span class="function-name">get</span>()</pre>
    </ul>

</dd>
</dl>
    <h2 class="section-header "><a name="Methods"></a>Methods</h2>

    <dl class="function">
    <dt>
    <a name = "credentials:get"></a>
    <strong>credentials:get ()</strong>
    </dt>
    <dd>
    Gets credentials, refreshes if required.
 Returns credentials, doesn't take a callback like AWS SDK.</p>

<p> When a refresh is executed, it will be done within a semaphore to prevent
 many simultaneous refreshes.



    <h3>Returns:</h3>
    <ol>

        success(true) + accessKeyId + secretAccessKey + sessionToken + expireTime or success(false) + error
    </ol>




</dd>
    <dt>
    <a name = "credentials:needsRefresh"></a>
    <strong>credentials:needsRefresh ()</strong>
    </dt>
    <dd>
    checks whether credentials have expired.



    <h3>Returns:</h3>
    <ol>

        boolean
    </ol>




</dd>
    <dt>
    <a name = "credentials:refresh"></a>
    <strong>credentials:refresh ()</strong>
    </dt>
    <dd>
    updates credentials.
 override in subclasses, should call <a href="../classes/Credentials.html#credentials:set">set</a> to set the properties.



    <h3>Returns:</h3>
    <ol>

        success, or nil+err
    </ol>




</dd>
    <dt>
    <a name = "credentials:set"></a>
    <strong>credentials:set (accessKeyId, secretAccessKey, sessionToken, expireTime)</strong>
    </dt>
    <dd>
    Sets credentials.
 additional to AWS SDK


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">accessKeyId</span>



        </li>
        <li><span class="parameter">secretAccessKey</span>



        </li>
        <li><span class="parameter">sessionToken</span>



        </li>
        <li><span class="parameter">expireTime</span>
         (optional) number (unix epoch based), or string (valid rfc 3339)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        true
    </ol>




</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-08-02 07:27:49 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
